package com.davies.learn.jbv.domain.dto;


import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.hibernate.validator.constraints.ScriptAssert;

import java.time.LocalDateTime;

/**
 * @author davies
 * @date 2023/7/16 10:54
 */
//因为java 17已经没有内置JavaScript引擎了,这里改用groovy,需要添加groovy-jsr223依赖
@ScriptAssert(lang = "groovy",
        script = "!_this.startDate||!_this.endDate||_this.startDate.plusDays(7).isAfter(_this.endDate)",
        message = "铁子,超过7天就别查了~")
@Data
public class UserQueryDTO {

    @NotNull
    private LocalDateTime startDate;

    @NotNull
    private LocalDateTime endDate;




    @NotBlank
    private String username;



}
